package framework.base.service;

import android.app.Activity;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.IBinder;

public class MainService extends Service implements Runnable {
	private byte[] lock = new byte[0];
	private boolean isrun;
	public static boolean serviceState = false;
	public static Activity mainAct;

	@Override
	public IBinder onBind(Intent arg0) {
		return null;
	}

	@Override
	public void onCreate() {
		super.onCreate();
		IntentFilter mFilter = new IntentFilter();
		mFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
		isrun = true;
		serviceState = true;

		Thread t = new Thread(this);
		t.start();
	}

	@Override
	public void run() {
		while (isrun) {
			synchronized (lock) {
				try {
					Thread.sleep(1000);
				} catch (Exception e) {
				}
			}
		}
	}

	@Override
	public void onDestroy() {
		super.onDestroy();
		isrun = false;
		serviceState = false;
	}
}
